$(function () {

    var eid = GetQueryString("eid");
    var wjId = GetQueryString("wjId");
    var sel = $.Params.create();
    sel.ajax("get", getAdminIP() + "qdQrs/" + eid, function (data) {
        if (data.success) {
            var val = data.result;
            $("#qrCode").val(val.qrCode);
            $("#pushType").val(val.pushType);
        } else {
            alert(data.msg);
        }
    })


    $("#addData").on("click", function () {
        var qrCode = $("#qrCode").val();
        var pushType = $("#pushType").val();
        if (qrCode == "") {
            alert("二维码参数不能为空！");
            return false;
        }
        if (pushType == "0") {
            alert("二维码类型不能为空！");
            return false;
        }
        var addSel = $.Params.create();
        addSel.addParams("qrCode", qrCode);
        addSel.addParams("pushType", pushType);
        addSel.ajax("put", getAdminIP() + "qdQrs/" + eid, function (data) {
            if (data.success) {
                if (wjId != null && wjId != undefined && wjId != "") {
                    window.location.href = "qrCodeList.html?wjId=" + wjId;
                } else {
                    window.location.href = "qrCodeList.html";
                }

            } else {
                alert(data.msg);
            }
        })
    })

    $("#cancelAdd").on("click", function () {
        history.go(-1);
    })
})